import {createRouter, createWebHistory} from 'vue-router'
import Layout from '@/layout/index.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/', component: Layout, redirect: 'school', children: [
        {path: 'school', name: 'School', component: () => import('@/views/school/index.vue')},
        {path: 'lesson', name: 'Lesson', component: () => import('@/views/lesson/index.vue')},
        {path: 'personal', name: 'PersonalCenter', component: () => import('@/views/PersonalCenter/index.vue')},
      ]
    },
    {path: '/login', name: 'Login', component: () => import('@/views/login/Login.vue')},
    {path: '/register', name: 'Register', component: () => import('@/views/login/Register.vue')},
    {path: '/forget', name: 'Forget', component: () => import('@/views/login/ForgetPassword.vue')},
    {path: '/exam/rule', name: 'ExamRule', component: () => import('@/views/school/ExamRule.vue')},
    {path: '/mis/guide', name: 'MisGuide', component: () => import('@/views/school/MisGuide.vue')},
    {path: '/activity', name: 'ActivityPage', component: () => import('@/views/school/ActivityPage.vue')},
    {path: '/value-added', name: 'ValueAddedService', component: () => import('@/views/school/ValueAddedService.vue')},
    {
      path: '/personal/edit',
      name: 'EditPersonalInfo',
      component: () => import('@/views/PersonalCenter/EditPersonalInfo.vue')
    },
    {
      path: '/personal/coach',
      name: 'CoachInfo',
      props: route => ({path: route.query.path}),
      component: () => import('@/views/PersonalCenter/CoachInfo.vue')
    },
    {path: '/common/problem', name: 'CommonProblem', component: () => import('@/views/PersonalCenter/CommonProblem.vue')},
    {path: '/:pathMatch(.*)*', name: 'NotFound', component: () => import('@/views/NotFound/index.vue')}
  ]
})


export default router
